home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 23
/
Amiga Format AFCD23 (Feb 1998, Issue 107).iso
/
-seriously_amiga-
/
shareware
/
archivers
/
magicarchiver
/
routines.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1997-12-06
|
21KB
|
813 lines
/* Application created by MUIBuild */
options results
parse arg com
MUIA_List_Format = 0x80423c0a /* V4 isg STRPTR */
MUIA_list_Active = 0x8042391c
ASLFR_InitialDrawer = 0x80080009
MUIA_Slider_Level = 0x8042ae3a
Application_Sleep = 0x80425711
List_Active = 0x8042391c
List_Insert_Bottom = -3
List_Insert_Top = -2
MUIV_List_Insert_Active = -1
MUIV_List_Insert_Bottom = -3
MUIV_List_Active_Bottom = -3
MUIV_List_Insert_Top = -2
Slider_Quiet = 0x80420b26
TRUE=1
FALSE=0
c=0
address MAGICARCHIVER
/* Variables Arexx */
/* ------------------- */
/* n : module en cours */
/* ------------------- */
/* ---- pour zoo ------- */
cmd.1.1='a'
cmd.1.2='u'
cmd.1.3='x'
/* ---- pour Lharc ----- */
cmd.2.1='-r -n a'
cmd.2.2='-r -n u'
cmd.2.3='-n x'
/* --- pour lha -------- */
cmd.3.1='a -r -x -N -Qa'
cmd.3.2='u -r -x -N -Qa'
cmd.3.3='x -N -Qa'
/* --------------------- */
mode='lha'
getvar num
n=result
say 'Routines'
do forever
com= getclip('COM')
if com~='' then say com
if com='ArchTout' then call ArchTout /*Sous programmes concernant l'archivage */
if com='CreatTout' then call CreatTout
if com='Quit' then break
if com='Init' then call Init
if com='NomA' then call NomA /* sous programmes concernant les modules */
if com='Src1' then call Src1
if com='Src2' then call Src2
if com='Src3' then call Src3
if com='Src4' then call Src4
if com='Src5' then call Src5
if com='Src6' then call Src6
if com='Src7' then call Src7
if com='Src8' then call Src8
if com='Src9' then call Src9
if com='SrcA' then call SrcA
if com='RepD' then call RepD
if com='Disk' then call Disk
if com='ModP' then call ModP
if com='ModM' then call ModM
if com='SetMod' then call SetMod
if com='Arch' then call Arch /* sous programmes concernant la maintenance */
if com='Creat' then call Creat
if com='Restau' then call Restau
if com='OUI' then call OUI
if com='NON' then call NON
if com='Eff' then call Eff
if com='MAJ' then call MAJ
if com='SAUVE' then call SAUVE
if com='SAUVM' then call SauveMod
if com='Select' then call select
if com='Arc' then call Arc /* sous programme concernant la configuration */
if com='Src' then call Src
if com='Rest' then call Rest
if com='ALst' then call ALst
if com='RArc' then call RArc
if com='RSrc' then call RSrc
if com='RRest' then call RRest
if com='RALst' then call RALst
if com='SC' then call SC
end
call setclip 'COM',''
call SauveModule /* Sauvegarde du dernier module actif */
address MAGICARCHIVER Quit /* Tout fermer */
exit
/* --------------- */
ArchTout:
call setclip 'COM',''
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Next
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Next
say 'Archive de touts les modules'
do m=1 to 30
if presence.m=TRUE then
do
if flag.m='OUI' then call Arch2
end
else
do
if exists('program:Fichiers/CFG/Config'||m) then
do
call Open('file','program:Fichiers/CFG/config'||m,'R')
Nom.m=readln('file')
Mode.m=readln('file')
Src.1.m=readln('file')
Src.2.m=readln('file')
Src.3.m=readln('file')
Src.4.m=readln('file')
Src.5.m=readln('file')
Src.6.m=readln('file')
Src.7.m=readln('file')
Src.8.m=readln('file')
Src.9.m=readln('file')
Src.10.m=readln('file')
RepD.m=readln('file')
Disk.m=readln('file')
Pat.m=readln('file')
Flag.m=readln('file')
Presence.m=TRUE /* Le module est en mémoire */
call Close('file')
if Flag.m='OUI' then call Arch2
end
end
end
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Prev
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Prev
return
CreatTout:
call setclip 'COM',''
return
Init:
say 'Initialisation'
call SetClip 'COM',''
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Initialisation'
/* Lire le fichier de configuration */
call Open('file','program:Fichiers/CFG/Config','R')
RepArc = Readln('file')
Setvar ArcDir RepArc
RepSrc = Readln('file')
SetVar SrcDir RepSrc
RepRest= Readln('file')
SetVar DestDir RepRest
ActLst= Readln('file')
SetVar Liste ActLst
say Liste
call Close('file')
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Next /* Activer la page Modules */
n=1 /* pour remplir les chaines */
call LireModule n /* lire le premier module */
call Open('file','program:Fichiers/'ActLst,'R')
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Next
say 'lecture liste'
j=1
do forever
L = readln('file')
ListeArc.j=L
j=j+1
say L
if L=='' then break
list ID Liste INSERT POS MUIV_List_Insert_Bottom STRING L
end
NArc=j-2
say NArc
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Next
string ID Arc CONTENT RepArc
string ID Src CONTENT RepSrc
string ID Rest CONTENT RepRest
string ID ALst CONTENT ActLst
say 'fin lecture'
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Prev
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Prev
group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Prev /* Revenir a la page maitre */
call Close('file')
return
Select:
call SetClip 'COM',''
call QuelArch
return
MAJ:
call SetClip 'COM',''
j=1
list ID Liste STRING
do i=1 to 30
if exists('program:Fichiers/CFG/Config'||i) then
do
call Open('file','Program:Fichiers/CFG/Config'||i,'R')
nom = readln('file')
say 'nom 'nom
if nom~='' then
do
ListeArc.j=nom
do k=1 to 15
Flag.j=readln('file')
end
list ID Liste POS List_Insert_Bottom INSERT STRING nom','Flag.j
say 'Liste 'ListeArc.j
j=j+1
end
call Close('file')
end
end
NArc=j-1
return
SAUVE:
call SetClip 'COM',''
call Open('file','program:Fichiers/'ActLst,'W')
do i=1 to NArc
call writeln('file',ListeArc.i||','||Flag.i)
end
call Close('file')
return
SetMod:
call SetClip 'COM',''
call SauveModule
slider ID sld ATTRS MUIA_Slider_Level
n = result
string ID NumMo CONTENT n
setvar num n
call LireModule n
call SetClip 'COM',''
return
NomA:
call SetClip 'COM',''
getvar ArcDir
call ReqArc
Nom.n=result
pos=LastPos('/',Nom.n)
Nom.n=right(Nom.n,length(Nom.n)-pos)
string ID NomA CONTENT Nom.n
say n
say Nom.n
return
Src1:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
RepSrc1.n=result
string ID Src1 CONTENT RepSrc1.n
say RepSrc1.n
return
Src2:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Src2 CONTENT result
RepSrc2.n=result
return
Src3:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Src3 CONTENT result
RepSrc3.n=result
return
Src4:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Src4 CONTENT result
RepSrc4.n=result
return
Src5:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Src5 CONTENT result
RepSrc5.n=result
return
Src6:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Src6 CONTENT result
RepSrc6.n=result
return
Src7:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Src7 CONTENT result
RepSrc7.n=result
return
Src8:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Src8 CONTENT result
RepSrc8.n=result
return
Src9:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Src9 CONTENT result
RepSrc9.n=result
return
SrcA:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Src10 CONTENT result
RepSrc10.n=result
return
RepD:
call SetClip 'COM',''
getvar DestDir
call ReqDir
string ID RepD CONTENT result
RepDest.n=result
return
Disk:
call SetClip 'COM',''
getvar SrcDir
call ReqDir
string ID Disk CONTENT result
DiskDest.n=result
return
ModP:
call SetClip 'COM',''
call SauveModule
getvar num
n=result
if n<30 then do
n=n+1
setvar num n
end
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Passage au module suivant : N° 'n
slider ID sld ATTRS MUIA_Slider_Level n
string ID NumMo CONTENT n
call LireModule n
do while getclip('COM')~='SetMod'
end
call SetClip 'COM',''
return
ModM:
call SetClip 'COM',''
call SauveModule
getvar num
n=result
if n>1 then do
n=n-1
setvar num n
end
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Passage au module précédent : N° 'n
slider ID sld ATTRS MUIA_Slider_Level n
string ID NumMo CONTENT n
call LireModule n
do while getclip('COM')~='SetMod'
end
call SetClip 'COM',''
return
ReqArc:
aslrequest ID Titre TITLE '"Selection Archive"' ATTRS ASLFR_InitialDrawer result
return result
ReqDir:
aslrequest ID Titre TITLE '"Selection Repertoire"' ATTRS ASLFR_InitialDrawer result
return result
ReqFile:
aslrequest ID Titre TITLE '"Selection Fichier"' ATTRS ASLFR_InitialDrawer result
return result
SauveMod:
call SetClip 'COM',''
call Sauvemodule
return
SauveModule:
say 'Sauvegarde du module N° '||n
call Open('file','Program:Fichiers/CFG/Config'||n,'W')
string ID NomA
Nom.n=result
call writeln('file',result)
cycle ID Mde
Mode.n=result
call writeln('file',result)
string ID Src1
Src.1.n=result
call writeln('file',result)
string ID Src2
Src.2.n=result
call writeln('file',result)
string ID Src3
Src.3.n=result
call writeln('file',result)
string ID Src4
Src.4.n=result
call writeln('file',result)
string ID Src5
Src.5.n=result
call writeln('file',result)
string ID Src6
Src.6.n=result
call writeln('file',result)
string ID Src7
Src.7.n=result
call writeln('file',result)
string ID Src8
Src.8.n=result
call writeln('file',result)
string ID Src9
Src.9.n=result
call writeln('file',result)
string ID Src10
Src.10.n=result
call writeln('file',result)
String ID RepD
RepD.n=result
call writeln('file',result)
string ID Disk
Disk.n=result
call writeln('file',result)
string ID Patrn
Pat.n=result
call writeln('file',result)
cycle ID AM
Flag.n=result
call writeln('file',result)
call Close('file')
return
LireModule:
parse arg i
if presence.i=TRUE then do
say 'lecture deja faite'
string ID NomA CONTENT Nom.i
cycle ID Mde LABEL Mode.i
string ID Src1 CONTENT Src.1.i
string ID Src2 CONTENT Src.2.i
string ID Src3 CONTENT Src.3.i
string ID Src4 CONTENT Src.4.i
string ID Src5 CONTENT Src.5.i
string ID Src6 CONTENT Src.6.i
string ID Src7 CONTENT Src.7.i
string ID Src8 CONTENT Src.8.i
string ID Src9 CONTENT Src.9.i
string ID Src10 CONTENT Src.10.i
string ID RepD CONTENT RepD.i
string ID Disk Content Disk.i
string ID Patrn CONTENT Pat.i
cycle ID AM LABEL Flag.i
do j=1 to 1000
nop
end
end
else
do
if exists('Program:Fichiers/CFG/Config'||i) then do
say 'Lecture du module N° '||i
Call Open('file','Program:Fichiers/CFG/Config'||i,'R')
Nom.i = readln('file')
string ID NomA CONTENT Nom.i
Mode.i = readln('file')
cycle ID Mde LABEL Mode.i
Src.1.i = readln('file')
string ID Src1 CONTENT Src.1.i
Src.2.i = readln('file')
string ID Src2 CONTENT Src.2.i
Src.3.i = readln('file')
string ID Src3 CONTENT Src.3.i
Src.4.i = readln('file')
string ID Src4 CONTENT Src.4.i
Src.5.i = readln('file')
string ID Src5 CONTENT Src.5.i
Src.6.i = readln('file')
string ID Src6 CONTENT Src.6.i
Src.7.i = readln('file')
string ID Src7 CONTENT Src.7.i
Src.8.i = readln('file')
string ID Src8 CONTENT Src.8.i
Src.9.i = readln('file')
string ID Src9 CONTENT Src.9.i
Src.10.i = readln('file')
string ID Src10 CONTENT Src.10.i
RepD.i = readln('file')
string ID RepD CONTENT RepD.i
Disk.i = readln('file')
string ID Disk CONTENT Disk.i
Pat.i = readln('file')
string ID Patrn CONTENT Pat.i
Flag.i = readln('file')
cycle ID AM LABEL Flag.i
Presence.i=TRUE
call Close('file')
end
end
return
Arch:
call setclip 'COM',''
call QuelArch
call Arch2
return
Arch2:
call AffCr(Nom.m||':Mise à jours archive.')
/* Verifier l'éxistance du répertoire destination et l'éxistance de l'archive */
if exists(RepD.m)=0 then do
call AffCr('Le repertoire Destination 'RepD.m' n"éxiste pas.')
return
end
if exists(RepD.m'/'Nom.m)=0 then do
call AffCr('Il faut créer l"archive avant.')
return
end
application ATTRS Application_Sleep 1
address command 'copy from '||RepD.m||'/'||Nom.m||' to ram: >ram:temp1'
call erreur 1
if Mode.m='lha'|Mode.m='Lha' then k=3
if Mode.m='lzx' then k=2
if Mode.m='zoo' then k=1
do j=1 to 10
if Src.j.m~='' then do
address command 'c:'||Mode.m||' '||cmd.k.2||' RAM:'||Nom.m||' '||Src.j.m||'/* >ram:temp2'
end
end
address command 'copy from ram:'||Nom.m||' to '||RepD.m
if Disk.m~='' then
do
address command 'updatecopy from ram:'||Nom.m||' to '||Disk.m
call AffCr(Nom.m||':Mise sur disque.')
end
address command 'delete ram:'||Nom.m
application ATTRS Application_Sleep 0
call AffCr(Nom.m||':Mise à jours terminée.')
list ID liste ATTRS MUIA_List_Active m-1
return
Creat:
call setclip 'COM',''
call QuelArch
call AffCr(Nom.m||':Création archive.')
if exists(RepD.m)=0 then do
call AffCr('Le repertoire Destination 'RepD.m' n"éxiste pas.')
return
end
application ATTRS Application_Sleep 1
if Mode.m='lha'|Mode.m='Lha' then k=3
if Mode.m='lzx' then k=2
if Mode.m='zoo' then k=1
address command 'c:'||Mode.m||' '||cmd.k.1||' RAM:'||Nom.m||' '||Src.1.m||'/* >ram:Temp2'
do j=2 to 10
if Src.j.m~='' then address command 'c:'||Mode.m||' '||cmd.k.2||' RAM:'||Nom.m||' '||Src.j.m||'/* >ram:temp2'
end
address command 'copy from ram:'||Nom.m||' to '||RepD.m
address command 'delete ram:'||Nom.m
application ATTRS Application_Sleep 0
call AffCr(Nom.m||':Création terminée.')
address command 'copy 'RepD.m'/'Nom.m' to 'Disk.m
return
Restau:
return
AffList:
say 'Réaffichage liste'
list ID Liste STRING
do j=NArc by -1 to 1
list ID Liste INSERT POS MUIV_List_Insert_Top STRING ListeArc.j
end
return
AffCr:
parse Arg Cr.c
say 'Mise à jours CR'
list ID LCR STRING
do j=c by -1 to 0
list ID LCR INSERT POS MUIV_List_Insert_Top STRING cr.j
end
c=c+1
return
OUI:
call setclip 'COM',''
say 'oui'
Flag.m='OUI'
call change 'OUI'
return
NON:
call setclip 'COM',''
say 'non'
Flag.m='NON'
call change 'NON'
return
change:
parse arg F
list ID liste ATTRS List_Active
p=result+1
say p
S=ListeArc.p
say S
S1=left(S,lastpos(',',S)-1)
ListeArc.p=S1','F
say S1
call AffList
fin=FALSE
do j=1 to 30
if presence.j~=TRUE then call LireModule j /* Se le module n'est pas en mémoire le prendre */
if S1=Nom.j then do
say 'module trouvé'
Flag.j=F
k=j
fin=TRUE
end
if fin=TRUE then leave
end
if k=n then do /* il faut aussi modifier le module en cours */
/* group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Next */ /* se placer sur la page des modules */
cycle ID AM LABEL Flag.k /* Modifier le drapeau */
/* group ID Root ATTRS MUIA_Group_ActivePage MUIV_Group_ActivePage_Prev */ /* et revenir sur la page maintenance */
end
return
Eff:
call setclip 'COM',''
say m
say NArc
if m=NArc then NArc=NArc-1
else do
do j=m to NArc
k=j+1
ListeArc.j=ListeArc.k
say j' = 'k
end
NArc=NArc-1
end
call AffList
/* Call Sauve */
return
erreur:
parse arg e
call Open('file','ram:temp'||e,'R')
err=readln('file')
say err
call close('file')
return
/* Routines concernant la partie CONFIGURATION */
/* ------------------------------------------- */
Arc:
call SetClip 'COM',''
string ID Arc
Setvar ArcDir result
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Modification du répertoire contenant les archives -> 'result
return
RArc:
call SetClip 'COM',''
getvar ArcDir
aslrequest ID Titre TITLE '"Selection Repertoire"' ATTRS ASLFR_InitialDrawer result
RepArc=result
string ID Arc CONTENT RepArc
Setvar ArcDir RepArc
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Modification du répertoire contenant les archives -> 'RepArc
return
/* ------------------------------------------- */
Src:
call SetClip 'COM',''
string ID Src
Setvar RepSrc result
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Modification du répertoire contenant les données -> 'Result
return
RSrc:
call SetClip 'COM',''
getvar SrcDir
aslrequest ID Titre TITLE '"Selection Repertoire"' ATTRS ASLFR_InitialDrawer result
RepSrc=result
string ID Src CONTENT RepSrc
Setvar SrcDir RepSrc
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Modification du répertoire contenant les données -> 'RepSrc
return
/* ------------------------------------------- */
Rest:
call SetClip 'COM',''
string ID Rest
Setvar DestDir result
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Modification du répertoire pour restauration -> 'Result
return
RRest:
call SetClip 'COM',''
getvar DestDir
aslrequest ID Titre TITLE '"Selection Repertoire"' ATTRS ASLFR_InitialDrawer result
RepRest=result
string ID Rest CONTENT RepRest
Setvar DestDir RepRest
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Modification du répertoire pour restauration -> 'RepRest
return
/* --------------------------------------------- */
ALst:
call SetClip 'COM',''
string ID ALst
ActLst=result
ActLst=right(ActLst,length(ActLst)-lastpos('/',ActLst))
Setvar Liste Actlst
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Modification de la liste courante -> 'ActLst
return
RALst:
call SetClip 'COM',''
getvar Liste
result = 'Program:FICHIERS'
aslrequest ID Titre TITLE '"Selection Fichier"' ATTRS ASLFR_InitialDrawer result
ActLst=result
string ID ALst CONTENT ActLst
ActLst=right(ActLst,length(ActLst)-lastpos('/',ActLst))
Setvar Liste ActLst
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Modification de la liste courante -> 'ActLst
return
/* --------------------------------------------- */
SC:
call setclip 'COM',''
call Open('file','program:Fichiers/CFG/Config','W')
string ID Arc
RepArc=result
Setvar ArcDir RepArc
call writeln('file',RepArc)
string ID Src
RepSrc=result
Setvar SrcDir RepSrc
call Writeln('file',RepSrc)
string ID Rest
RepRest=result
setvar DestDir RepRest
call Writeln('file',RepRest)
string ID ALst
ActLst=result
Setvar Liste ActLst
call writeln('file',ActLst)
call Close('file')
list ID Stat INSERT POS MUIV_List_Insert_Bottom STRING 'Sauvegarde de la configuration OK'
return
QuelArch:
list ID liste
say result
if result~='' then
do
L1=result
pos=lastpos(',',L1)
L1=left(L1,pos-1)
string ID NomM CONTENT L1
do m=1 to 30
if presence.m=TRUE & L1=Nom.m then
do
b=1
say 'lecture deja faite'
end
else
do
if exists('program:Fichiers/CFG/Config'||m) then
do
call Open('file','program:Fichiers/CFG/config'||m,'R')
L2=readln('file')
say L2
b=0
if L1=L2 then
do
Nom.m=L1
Mode.m=readln('file')
Src.1.m=readln('file')
Src.2.m=readln('file')
Src.3.m=readln('file')
Src.4.m=readln('file')
Src.5.m=readln('file')
Src.6.m=readln('file')
Src.7.m=readln('file')
Src.8.m=readln('file')
Src.9.m=readln('file')
Src.10.m=readln('file')
RepD.m=readln('file')
Disk.m=readln('file')
Flag.m=readln('file')
Presence.m=TRUE /* Le module est en mémoire */
say m
b=1
end
call Close('file')
end
end
if b=1 then break
end
end
return